home *** CD-ROM | disk | FTP | other *** search
-
- ;Graphing program, and fractal convergence diagram
- ;c1998 Stuart Reeves Module-grapher
- .setup
- ;-----------------------------------setup
-
- version$="$VER: ModuleGrapher 1.1 (30.7.98) Stuart Reeves"
- ver$=Str$(1.1)
- title$="Module-Grapher, version "+ver$+"; "+Chr$(169)+"1998 - Stuart Reeves"
-
- WBStartup:NoCli
- WBenchToFront_:WbToScreen 0
- mg$="ModGraph" ;iconpath
- c_path$="envarc:mdlgraph.cfg" ;window config path
- p_path$="data/mdlgraph.prefs" ;prefs path
- Format "-#0.00"
- #tag=$80080000
- #win_c=0:#win_fc=1:#win_g=2
- #win_f=3:#win_h=4:#win_p=5
- DefaultIDCMP $2|$4|$8|$10|$20|$40|$100|$200|$400|$40000|$80000 ;optimise later
-
- #fld_cfg=18:#fld_prefs=5
-
- ;...................................setup the vars
- .vars
-
- NEWTYPE.convergence ;convergence vars
- pos_x.q:iter.b ;x position, no. iterations
- stp_x.q:stp_y ;size of plot
- x:c ;dummuy vars
- x_min:x_max
- y_min:y_max
- xl.w:yl
- x_add:y_add ;precalc stuff
- End NEWTYPE
- USEPATH c
- c.convergence\x_min=-40,40,-40,40 ;TEMP VARS!
- c.convergence\iter=10:\c=\y_min
- \xl=QAbs(\x_min)+QAbs(\x_max) ;find modulus of length
- \yl=QAbs(\y_min)+QAbs(\y_max)
-
- NEWTYPE.graph
- gx.q[1000]:gy[1000] ;points to plot
- pnt.w ;default points
- a.q:b:c:pi_mul
- t:x:y ;parameter/temp vars
- x_mul.w:y_mul
- x_off:y_off
- ia.q:ib:ic:ip
- End NEWTYPE
- g.graph\pnt=100,2,2,2,2
-
- NEWTYPE.flags
- win_c.b:win_fc
- win_g:win_f
- win_h:win_p
- drw_g:drw_f ;draw flags
- u_flg:q_flg ;points update/quit
- cg_flg:cf_flg ;cycle (grp+frc)
- r_flg:s_flg ;requesters/screen
- End NEWTYPE
- f.flags\drw_g=1,0,1,0,0,0
-
- NEWTYPE.resize ;gt list resizing vars
- wid.w:hgt
- tsize:bsize ;for titlebar/border size
- ;gadget vars
- gwid:ghgt ;common height/width of the gadgets
- xrow_1:xrow_2
- xrow_3:xrow_4
- yrow_1:yrow_2 ;gadget rows
- yrow_3:yrow_4
- syrow_1 ;special yrow
- ww:wh ;easier vars
- End NEWTYPE
- r.resize\xrow_1=0 ;dummy!
-
- NEWTYPE.wininfo
- ctrlwid.w:ctrlhgt
- ctrlpos_x:ctrlpos_y
- frc_ctrlwid:frc_ctrlhgt
- frc_ctrlpos_x:frc_ctrlpos_y
- grpwid:grphgt
- grppos_x:grppos_y
- frcwid:frchgt
- frcpos_x:frcpos_y
- hlpwid:hlphgt
- hlppos_x:hlppos_y
- prfwid:prfhgt
- prfpos_x:prfpos_y
- End NEWTYPE
- w.wininfo\ctrlwid=400,100 ;define the unchanging vars
- w\frc_ctrlwid=256,130
- w\hlpwid=WBWidth,46,0,WBHeight-46
- w\prfwid=200,170
-
- hlptxt$="Read this for help!":hlptxt_old$=hlptxt$
-
- NEWTYPE.font
- name.s:ysize.b
- End NEWTYPE
- ysize.b=11
- .
- ;-----------------------------------
- .includes
- XINCLUDE "includes/macros.i"
-
- Macro t:g\t=g\t+(g\pi_mul*Pi)/g\pnt:End Macro ;parameter macro
-
- XINCLUDE "includes/modules.i"
-
- XINCLUDE "includes/reqinfo.i"
-
- ;...................................general file ops
- .fileops
- If MakeCommodity("Module-Grapher","Module-Grapher, v"+ver$+"; Stuart Reeves","Produce graphs and fractals")=False
- error{0}
- EndIf
-
- If WBDepth<4
- Request "Error!","Module-Grapher requires at least|16 colours to look any good!||Change your WB depth","Okay"
- Exec "sys:prefs/screenmode"
- End
- EndIf
-
- If Exists(c_path$) AND r\ww=WBWidth AND r\wh=WBHeight
- If OpenFile(0,c_path$)
- !fld_cfg
- For i.b=0 To #fld_cfg:Get 0,i:Next
- Else error{1}
- EndIf
- Else
- USEPATH w
- r\ww=WBWidth,WBHeight
- f\win_c=1,0,0,0,0
- \ctrlpos_x=0,16
- \frc_ctrlpos_x=r\ww-w\frc_ctrlwid,16
- \grpwid=300
- If r\wh<300 ;non-i/laced wb's
- \grphgt=200
- Else \grphgt=300
- EndIf
- \grppos_x=0,(r\wh-\grphgt)/1.5
- \frcwid=r\ww/2,r\wh/2
- \frcpos_x=r\ww-r\ww/2,(r\wh-r\wh/2)/1.5
- If OpenFile(0,c_path$)
- !fld_cfg
- For i.b=0 To #fld_cfg:Put 0,i:Next
- Else error{1}
- EndIf
- EndIf
- CloseFile 0
-
- If Exists(p_path$)
- If OpenFile(1,p_path$)
- !fld_prefs ;define the vars
- For i.b=0 To #fld_prefs:Get 1,i:Next
- CloseFile 1
- Else error{2}
- EndIf
- Else
- Request "Error!","Can't find prefs file!||Using defaults...","Okay"
- ; *f\name="helvetica.font",11
- g\ia=.05:g\ib=.05:g\ic=.05:g\ip=.1
- JSR prefs
- EndIf
- LoadFont 0,"helvetica.font",ysize
- ;If Exists("fonts:"+*f\name)
- ; LoadFont 0,*f\name,*f\ysize
- ;Else Request "Error!","Can't find "+*f\name+"||Defaulting to Topaz.font instead","Okay"
- ;EndIf
-
- If GetIconObject(mg$)
- If LCase$(FindToolValue("REQUESTERS"))<>"on"
- f\r_flg=0:Else f\r_flg=1
- EndIf
- PutIconObject(mg$):FreeIconObject ;write changes to disk/free up
- Else error{3}
- EndIf
-
- ;InitShape 0,44,80,3
- LoadShape 0,"data/logo.shp"
- ;DecodeShapes 0,?logo
-
- ;...................................screen setup
-
- ;If f\s_flg=1
- ; Screen 0,0,0,640,512,7,$8000+$4,title$,1,0
- ; AGARGB 0,149,149,149:AGARGB 2,255,255,255 ;grey, black, white
- ; AGARGB 3,59,103,160:AGARGB 4,123,123,123:AGARGB 5,175,175,175 ;blue, grey2, grey3
- ; AGARGB 6,170,144,124:AGARGB 7,255,169,151 ;pink, pink2
- ; For i.b=8 To 31 ;setup plotting colours
- ; AGARGB i,rd.w,gr.w,bl.w
- ; rd=rd+11:gr=gr+11:bl=bl+11
- ; Next
- ;EndIf
-
- ;...................................menu 0
- .menus
- #bar=$0000
- #check=$0001+$0008
- #text=$0002
- #disabled=$0010
- #itemtoggle=$0100
-
- GTMenuTitle 0,0,"Program"
- GTMenuItem 0,#text,0,0,"Help","H"
- GTMenuItem 0,#text,0,1,"About","A"
- GTMenuItem 0,#text,0,2,"Iconify"
- GTMenuItem 0,#bar,0,3 ;separator bar
- GTMenuItem 0,#text,0,4,"Quit","Q"
-
- GTMenuTitle 0,1,"Windows" ;window selection
- GTMenuItem 0,#check+#itemtoggle,1,0,"Graph control"
- GTMenuItem 0,#check,1,1,"Fractal control"
- GTMenuItem 0,#check,1,2,"Graph"
- GTMenuItem 0,#check,1,3,"Fractal"
- GTMenuItem 0,#check,1,4,"Help box"
-
- GTMenuTitle 0,#text,"Settings"
- GTMenuItem 0,#text,2,0,"Preferences","P"
- GTMenuItem 0,#text,2,1,"Snapshot windows"
- CreateMenuStrip 0
-
- ;-----------------------------------end setup
- .
- ;-----------------------------------main loop
- .main
- JSR open
- If GTMenuChecked(0,1,0)=-1 AND f\win_fc=0 ;little bit to sort out menus
- GTMenuState 0,1,0,Off
- EndIf
- If GTMenuChecked(0,1,1)=-1 AND f\win_c=0
- GTMenuState 0,1,1,Off
- EndIf
-
- Repeat
-
- ;***EVENTS***
-
- ev.l=Event:evw.l=EventWindow
-
- If CommodityEvent JSR chkcmd
-
- If AppEvent
- DelAppIcon(0):JSR open
- EndIf
-
- If ev.l=$200
- Select evw.l
- Case #win_c
- If f\r_flg=1:!qchk ;check to see if user wants to quit
- Else f\q_flg=1
- EndIf
- Case #win_fc
- If f\r_flg=1:!qchk ;and again
- Else f\q_flg=1
- EndIf
- Case #win_g
- CloseWindow 2:GTSetMenuChecked 0,1,2,Off:f\win_g=0
- Case #win_f
- CloseWindow 3:GTSetMenuChecked 0,1,3,Off:f\win_f=0
- Case #win_h
- DetachGTList 2:Free GTList 2:CloseWindow 4:GTSetMenuChecked 0,1,4,Off:f\win_h=0
- Case #win_p
- DetachGTList 3:Free GTList 3:CloseWindow 5:f\win_p=0
- End Select
- EndIf
-
- If ev.l=$100 JSR chkmenu
-
- If f\win_c=1 JSR chkwin_c ;win checks
- If f\win_fc=1 JSR chkwin_fc
- ; If f\win_f=1 JSR chkwin_f
- If f\win_h=1 JSR chkwin_h
- If f\win_p=1 JSR chkwin_p
-
- If ev.l=$2
- Select evw
- Case #win_c
- DetachGTList 0:Free GTList 0
- JSR gtwin_c
- AttachGTList 0,#win_c
- Case #win_fc
- DetachGTList 1:Free GTList 1
- JSR gtwin_fc
- AttachGTList 1,#win_fc
- Case #win_g
- Use Window 2
- w\grpwid=WindowWidth:w\grphgt=WindowHeight ;get new params, and update muls.
- JSR updcyc_grp
- Use Window 2
- WBox 0,0,w\grpwid,w\grphgt,0
- f\drw_g=1
- Case #win_p ;clear the window and resize gadgets
- DetachGTList 3:Free GTList 3
- JSR gtwin_p
- AttachGTList 3,5
- End Select
- EndIf
-
- ;***END EVENTS***
-
- ;+++++++++++++++++++++++++++++++++begin ctrl gadget hit
-
- If f\drw_g=1 AND f\win_g=1 ;if exists and hasn't finished
- JSR calcgrp ;first calculate the graph points
- draw
- f\u_flg=GTStatus(0,9)
- If f\win_g=1
- JSR drwgrp ;and draw the graph
- EndIf
- EndIf
-
- ;+++++++++++++++++++++++++++++++++end ctrl hit
-
- ;+++++++++++++++++++++++++++++++++begin frc gadget hit
-
- If f\drw_f=1 AND f\win_f=1 ;if exists, and hasn't finished
- JSR drwfrc
- EndIf
-
- ;+++++++++++++++++++++++++++++++++end frc hit
-
- If f\drw_f=0 OR f\drw_g=0 VWait ;for multitasking purposes
- f\drw_g=0 ;to stop it continually drawing
-
- Until f\q_flg=1 OR RawStatus($45)
-
- ;-----------------------------------end main loop
-
- .quit
- If f\win_c=1 CloseWindow #win_c:If f\win_fc=1 CloseWindow #win_fc
- If f\win_g=1 CloseWindow #win_g:If f\win_h=1 CloseWindow #win_h
- If f\win_p=1 CloseWindow #win_p
- If f\r_flg=1 Request "Be nice to programmers!",req_end$,"Okay"
- End
- .
- ;===================================subroutines
-
- ;...................................stuff to startup/close prog
-
- .iconify
- If AddAppIcon(0,"Module-Grapher",mg$)
- JSR close
- Else
- Request "Error!","Could not iconify Module-Grapher...","Okay"
- EndIf
- RTS
-
- .open ;open the prog!
- If f\win_c=1 !ctrlwin:If f\win_fc=1 !frc_ctrlwin
- If f\win_g=1 !grpwin:If f\win_f=1 !frcwin
- If f\win_h=1 !hlpwin:If f\win_p=1 !prfwin
- RTS
-
- .close
- If f\win_c=1:DetachGTList 0:Free GTList 0:CloseWindow #win_c:EndIf
- If f\win_fc=1:DetachGTList 1:Free GTList 1:CloseWindow #win_fc:EndIf
- If f\win_g=1 CloseWindow 2
- If f\win_f=1 CloseWindow 3
- If f\win_h=1:DetachGTList 2:Free GTList 2:CloseWindow #win_h:EndIf
- If f\win_p=1:DetachGTList 3:Free GTList 3:CloseWindow #win_p:EndIf
- RTS
-
- ;...................................graph + frc stuff
-
- .calcgrp
- USEPATH g
- Use Window #win_c
- If \a=>99.95 \a=99.95:If \a<=-99.95 \a=-99.95
- If \b=>99.95 \b=99.95:If \b<=-99.95 \b=-99.95
- If \c=>99.95 \c=99.95:If \c<=-99.95 \c=-99.95
- If \pi_mul=>99.9 \pi_mul=99.9:If \pi_mul<=-99.9 \pi_mul=-99.9
- GTSetString 0,1,Str$(\a) ;update vars
- GTSetString 0,4,Str$(\b)
- GTSetString 0,7,Str$(\c)
- GTSetString 0,11,Str$(\pi_mul)
- \t=0 ;reset the parameter
- For n.w=0 To \pnt ;calculate points
- Select f\cg_flg
- Case 0:!t:!grp_0
- Case 1:!t:!grp_1
- Case 2:!t:!grp_2
- ; Case 3:!t:!grp_3
- ; Case 4:!t:!grp_4
- Case 5:!t:!grp_5
- ; Case 6:!t:!grp_6
- Case 7:!t:!grp_7
- End Select
- \gx[n]=(\x+1)*\x_mul+\x_off
- \gy[n]=(\y+1)*\y_mul+\y_off
- If n=\pnt f\drw_g=0
- Next
- RTS
-
- .drwgrp
- USEPATH g
- Use Window #win_g
- WBox 0,0,w\grpwid,w\grphgt,0
- For n.w=0 To \pnt
- If GTStatus(0,9)=0
- WPlot \gx[n],\gy[n],1
- Else If n>1 WLine \gx[n-1],\gy[n-1],\gx[n],\gy[n],2
- EndIf
- If n=\pnt f\drw_g=0
- Next
- RTS
-
- .drwfrc
- USEPATH c
- Use Window #win_f
- WTitle "Fractal - "+UStr$(InnerWidth)+"x"+UStr$(InnerHeight),"Fractal convergence window"
- \stp_x=InnerWidth/\xl,InnerHeight/\yl ;update winsize values
- \x_add=QAbs(\x_min)*\stp_x:\y_add=QAbs(\y_min)*\stp_y ;pre-calc!
- Repeat
- For \pos_x=\x_min To \x_max Step (1/\stp_x) ;increase x
- \x=\pos_x ;start value for pixel test
- For i.b=1 To \iter ;pixel iteration
- Select f\cf_flg
- Case 0:!frc_0
- Case 1:!frc_1
- Case 2:!frc_2
- Case 3:!frc_3
- Case 4:!frc_4
- Case 5:!frc_5
- Case 6:!frc_6
- End Select
- Next
- WPlot \pos_x*\stp_x+\x_add,\c*\stp_y+\y_add,QLimit(\x,-128,128)
- Next
- \c=\c+1/\stp_y ;increase y (constant)
- Until \c>\y_max OR GTStatus(1,3)=1
- GTMenuState 0,1,3,On:f\drw_f=0
- \pos_x=0:\c=\x_min
- hlptxt$="Drawing process has finished..."
- RTS
-
- ;...................................prefs stuff
-
- .winsnap ;find all win coords
- USEPATH w
- If f\win_c=1
- Use Window #win_c
- \ctrlpos_x=WindowX-r\bsize,WindowY-r\tsize
- EndIf
- If f\win_fc=1
- Use Window #win_fc
- \frc_ctrlpos_x=WindowX-r\bsize,WindowY-r\tsize
- EndIf
- If f\win_g=1
- Use Window #win_g
- \grppos_x=WindowX-r\bsize,WindowY-r\tsize
- \grpwid=WindowWidth,WindowHeight
- EndIf
- If f\win_f=1
- Use Window #win_f
- \frcpos_x=WindowX-r\bsize,WindowY-r\tsize
- \frcwid=WindowWidth,WindowHeight
- EndIf
- If OpenFile(0,c_path$)
- !fld_cfg
- For i.b=0 To #fld_cfg:Put 0,i:Next
- CloseFile 0
- Else error{1}
- EndIf
- RTS
-
- .prefs
- If OpenFile(1,p_path$)
- !fld_prefs
- For i.b=0 To #fld_prefs:Put 1,i:Next
- CloseFile 1
- Else error{2}
- EndIf
- RTS
-
- ;...................................gtlist 0-win_c
-
- .gtwin_c
- Use Window #win_c:r\wid=InnerWidth,InnerHeight ;font sensitivity
- WCls ;get rid of any excess gumpfff
- WBlit 0,0,r\hgt*.5-40 ;plot that logo!
- r\gwid=ysize*.75,ysize+6
- r\xrow_1=-r\bsize+r\wid*.15+40,-r\bsize+r\wid*.4+32,-r\bsize+r\wid*.65+24,-r\bsize+r\wid*.9+10
- r\yrow_1=-r\tsize+r\hgt*.35-r\ghgt/2,-r\tsize+r\hgt*.75-r\ghgt/2
-
- WLine 44+(r\xrow_1-r\gwid-35-44)/2,r\yrow_1+r\ghgt,44+(r\xrow_1-r\gwid-35-44)/2,r\yrow_2+6+r\ghgt,1
- WLine 45+(r\xrow_1-r\gwid-35-44)/2,r\yrow_1+r\ghgt,45+(r\xrow_1-r\gwid-35-44)/2,r\yrow_2+6+r\ghgt,2
- ;constant a
- GTButton 0,0,r\xrow_1-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,"<",$10
- GTString 0,1,r\xrow_1+r\gwid+10-r\gwid-35,r\yrow_1,50,r\ghgt,"A",$4,5,Str$(g\a)
- GTButton 0,2,r\xrow_1+r\gwid+60-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,">",$10
- ;constant b
- GTButton 0,3,r\xrow_2-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,"<",$10
- GTString 0,4,r\xrow_2+r\gwid+10-r\gwid-35,r\yrow_1,50,r\ghgt,"B",$4,5,Str$(g\b)
- GTButton 0,5,r\xrow_2+r\gwid+60-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,">",$10
- ;constant c
- GTButton 0,6,r\xrow_3-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,"<",$10
- GTString 0,7,r\xrow_3+r\gwid+10-r\gwid-35,r\yrow_1,50,r\ghgt,"C",$4,5,Str$(g\c)
- GTButton 0,8,r\xrow_3+r\gwid+60-r\gwid-35,r\yrow_1,r\gwid+10,r\ghgt,">",$10
-
- ;GTTags #tag+68,1
- GTCheckBox 0,9,r\xrow_4-r\gwid*1.5,r\yrow_1,0,0,"Line/Dot",$4+$100
- ;constant n*Pi
- GTButton 0,10,r\xrow_1-r\gwid-35,r\yrow_2,r\gwid+10,r\ghgt,"<",$10
- GTString 0,11,r\xrow_1+r\gwid+10-r\gwid-35,r\yrow_2,50,r\ghgt,"nxPi",$4,5,Str$(g\pi_mul)
- GTButton 0,12,r\xrow_1+r\gwid+60-r\gwid-35,r\yrow_2,r\gwid+10,r\ghgt,">",$10
-
- GTButton 0,13,r\xrow_2-r\gwid*3-5,r\yrow_2,r\gwid*6+10,r\ghgt,"Redraw",$10
-
- GTTags #tag+15,0 ;set the first item
- GTCycle 0,14,r\xrow_3-r\gwid*5-5,r\yrow_2,r\gwid*10+10,r\ghgt,"Module",$4,grpmdl$,0
-
- GTInteger 0,15,r\xrow_4-21,r\yrow_2,42,r\ghgt,"Points",$4,100
- RTS
-
- ;...................................gtlist 1-win_fc
-
- .gtwin_fc
- Use Window #win_fc:r\wid=InnerWidth,InnerHeight
- WCls
- r\gwid=ysize*.75,ysize+6
- r\xrow_1=-r\bsize+r\wid*.15,-r\bsize+r\wid*.4,-r\bsize+r\wid*.75
- r\yrow_1=-r\tsize+r\hgt*.25-r\ghgt/2,-r\tsize+r\hgt*.55-r\ghgt/2,-r\tsize+r\hgt*.85-r\ghgt/2
-
- GTString 1,0,r\xrow_1-25,r\yrow_1,50,r\ghgt,"X-min",$4,6,Str$(c\x_min)
-
- GTString 1,1,r\xrow_2-25,r\yrow_1,50,r\ghgt,"X-max",$4,6,Str$(c\x_max)
-
- GTButton 1,2,r\xrow_3-r\gwid*5-10,r\yrow_1,r\gwid*5+10,r\ghgt,"Start",$10
- GTButton 1,3,r\xrow_3+r\gwid*5-10-r\gwid*5+10,r\yrow_1,r\gwid*5+10,r\ghgt,"Stop",$10
-
- GTInteger 1,8,r\xrow_3-r\gwid*2.5-24,r\yrow_3,38,r\ghgt,"Iterations",$4,c\iter
- GTButton 1,4,r\xrow_3-r\gwid*2.5+14,r\yrow_3,r\gwid*5+10,r\ghgt,"Clear",$10
-
- GTString 1,5,r\xrow_1-25,r\yrow_2,50,r\ghgt,"Y-min",$4,6,Str$(c\y_min)
-
- GTString 1,6,r\xrow_2-25,r\yrow_2,50,r\ghgt,"Y-max",$4,6,Str$(c\y_max)
-
- GTTags #tag+15,0
- GTCycle 1,7,r\xrow_3-r\gwid*6-5,r\yrow_2,r\gwid*12+10,r\ghgt,"Formula",$4,frcmdl$,0
- RTS
-
- ;...................................gtlist 2-win_h
-
- .gtwin_h
- Use Window #win_h:r\wid=InnerWidth,InnerHeight
- WCls
- GTText 2,0,0,-r\tsize+r\hgt*.5-r\ghgt/2,r\ww-12,r\ghgt,"",$4,hlptxt$ ;the help box!+4 pizel gap at top
- RTS
-
- ;...................................gtlist 3-win_p
-
- .gtwin_p
- Use Window #win_p:r\wid=InnerWidth,InnerHeight
- WCls
- r\xrow_1=-r\bsize+r\wid*.25,-r\bsize+r\wid*.5,-r\bsize+r\wid*.75
- r\yrow_1=-r\tsize+r\hgt*.2-r\ghgt/2,-r\tsize+r\hgt*.45-r\ghgt/2,-r\tsize+r\hgt*.7-r\ghgt/2,-r\tsize+r\hgt*.9-r\ghgt/2
- r\syrow_1=r\yrow_4/2+r\ghgt*1.25+r\yrow_3/2
-
- WLine r\xrow_1-6,r\syrow_1,r\xrow_3+6,r\syrow_1,2
- WLine r\xrow_1-6,r\syrow_1-1,r\xrow_3+6,r\syrow_1-1,1
-
- GTButton 3,0,r\xrow_1-r\gwid*2-5,r\yrow_4,r\gwid*4+10,r\ghgt,"Save",$10
- GTButton 3,1,r\xrow_2-r\gwid*2-5,r\yrow_4,r\gwid*3+10,r\ghgt,"Use",$10
- GTButton 3,2,r\xrow_3-r\gwid*3-5,r\yrow_4,r\gwid*6+10,r\ghgt,"Cancel",$10
-
- GTString 3,3,r\xrow_1-25,r\yrow_1,50,r\ghgt,"A increment",$4,5,Str$(g\ia)
-
- GTString 3,4,r\xrow_3-25,r\yrow_1,50,r\ghgt,"B increment",$4,5,Str$(g\ib)
-
- GTString 3,5,r\xrow_1-25,r\yrow_2,50,r\ghgt,"C increment",$4,5,Str$(g\ic)
-
- GTString 3,6,r\xrow_3-25,r\yrow_2,50,r\ghgt,"Pi increment",$4,5,Str$(g\ip)
-
- GTButton 3,7,r\xrow_1-25,r\yrow_3-4,50,r\ghgt,"Font",$10
-
- If f\r_flg=1 req_flg.l=$100:Else req_flg=$0 ;make chk box on or off
- GTCheckBox 3,8,r\xrow_3-r\gwid*1.5,r\yrow_3,0,0,"Requesters",$4+req_flg
- RTS
-
- ;...................................checks
-
- .updcyc_grp
- USEPATH g
- Use Window #win_c
- evc.l=EventCode
- Select evc.l
- Case 0
- !grp_0vars:!eBdC
- hlptxt$=grp_0txt$:f\cg_flg=0:f\drw_g=1
- Case 1
- !grp_1vars:!eBdC
- hlptxt$=grp_1txt$:f\cg_flg=1:f\drw_g=1
- Case 2
- !grp_2vars:!eBeC
- hlptxt$=grp_2txt$:f\cg_flg=2:f\drw_g=1
- ; Case 3
- ; !grp_3vars:!dBdC
- ; hlptxt$=grp_3txt$:f\cg_flg=3:f\drw_g=1
- ; Case 4
- ; !grp_4vars:!dBdC
- ; hlptxt$=grp_4txt$:f\cg_flg=4:f\drw_g=1
- Case 5
- !grp_5vars:!dBdC
- hlptxt$=grp_5txt$:f\cg_flg=5:f\drw_g=1
- ; Case 6
- ; !grp_6vars:!dBdC
- ; hlptxt$=grp_6txt$:f\cg_flg=6:f\drw_g=1
- Case 7
- !grp_7vars:!eBdC
- hlptxt$=grp_7txt$:f\cg_flg=7:f\drw_g=1
- End Select
- RTS
-
- .updcyc_frc
- USEPATH c
- Use Window #win_fc
- evc.l=EventCode
- Select evc.l
- Case 0
- f\cf_flg=0:!frc_0vars
- hlptxt$="Formula: "+frc_0txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 1
- f\cf_flg=1:!frc_1vars
- hlptxt$="Formula: "+frc_1txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 2
- f\cf_flg=2!frc_2vars
- hlptxt$="Formula: "+frc_2txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 3
- f\cf_flg=3:!frc_3vars
- hlptxt$="Formula: "+frc_3txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 4
- f\cf_flg=4:!frc_4vars
- hlptxt$="Formula: "+frc_4txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 5
- f\cf_flg=5:!frc_5vars
- hlptxt$="Formula: "+frc_5txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- Case 6
- f\cf_flg=6:!frc_6vars
- hlptxt$="Formula: "+frc_6txt$+"; with "+UStr$(\iter)+" iterations per pixel"
- End Select
- GTSetString 1,0,Str$(\x_min)
- GTSetString 1,1,Str$(\x_max)
- GTSetString 1,5,Str$(\y_min)
- GTSetString 1,6,Str$(\y_max)
- RTS
-
- .chkmenu
- Select MenuHit
- Case 0 ;menu 0
- If ItemHit=0 Exec "sys:utilities/multiview docs/modgraph.guide" ;online help!
- If ItemHit=1
- Request "About this program",req_ab$,"Okay"
- FlushEvents
- EndIf
- If ItemHit=2 JSR iconify
- If ItemHit=4 AND f\r_flg=1:!qchk:EndIf
- If ItemHit=4 AND f\r_flg=0 JMP quit
- Case 1
- If GTMenuChecked(0,1,0)=0 AND f\win_c=1 ;check for ctrl win
- DetachGTList 0:Free GTList 0:CloseWindow 0:f\win_c=0
- GTMenuState 0,1,1,Off ;make sure other is unable to close
- Else If GTMenuChecked(0,1,0)=-1 AND f\win_c=0
- !ctrlwin
- GTMenuState 0,1,1,On:EndIf
- EndIf
- If GTMenuChecked(0,1,1)=0 AND f\win_fc=1 ;check for frc ctrl win
- DetachGTList 1:Free GTList 1:CloseWindow 1:f\win_fc=0
- GTMenuState 0,1,0,Off
- Else If GTMenuChecked(0,1,1)=-1 AND f\win_fc=0
- !frc_ctrlwin
- GTMenuState 0,1,0,On:EndIf
- EndIf
- If GTMenuChecked(0,1,2)=0 AND f\win_g=1 ;check for graph win
- CloseWindow 2:f\win_g=0
- Else If GTMenuChecked(0,1,2)=-1 AND f\win_g=0
- !grpwin:f\drw_g=1:EndIf
- EndIf
- If GTMenuChecked(0,1,3)=0 AND f\win_f=1 ;check for fractal win
- CloseWindow 3:f\win_f=0
- Else If GTMenuChecked(0,1,3)=-1 AND f\win_f=0
- !frcwin
- USEPATH c
- \pos_x=0:\c=\x_min:EndIf ;reset the drawing vars
- EndIf
- If GTMenuChecked(0,1,4)=0 AND f\win_h=1 ;check for help win
- DetachGTList 2:Free GTList 2:CloseWindow 4:f\win_h=0
- Else If GTMenuChecked(0,1,4)=-1 AND f\win_h=0
- !hlpwin
- GTSetString 2,0,hlptxt$:EndIf
- EndIf
- Case 2
- If ItemHit=0 AND f\win_p=0
- !prfwin
- Else Activate 5
- EndIf
- If ItemHit=1 JSR winsnap
- End Select
- RTS
-
- .chkwin_c
- USEPATH g
- Use Window #win_c
- If GTGetString(0,1)<>Str$(\a) ;find+limit vars
- \a=Val(GTGetString(0,1))
- If \a=>99.95 \a=99.95:If \a<=-99.95 \a=-99.95
- EndIf
- If GTGetString(0,4)<>Str$(\b)
- \b=Val(GTGetString(0,4))
- If \b=>99.95 \b=99.95:If \b<=-99.95 \b=-99.95
- EndIf
- If GTGetString(0,7)<>Str$(\c)
- \c=Val(GTGetString(0,7))
- If \c=>99.95 \c=99.95:If \c<=-99.95 \c=-99.95
- EndIf
- If GTGetString(0,11)<>Str$(\pi_mul)
- \pi_mul=Val(GTGetString(0,11))
- If \pi_mul=>99.9 \pi_mul=99.9:If \pi_mul<=-99.9 \pi_mul=-99.9
- EndIf
- If GTStatus(0,13)=1 ;redraw button
- f\drw_g=1
- hlptxt$="Graph window redrawn..."
- EndIf
- If GTStatus(0,0)=1:\a=\a-\ia:f\drw_g=1:EndIf ;check the gadgets to change vars a+b
- If GTStatus(0,2)=1:\a=\a+\ia:f\drw_g=1:EndIf
- If GTStatus(0,3)=1:\b=\b-\ib:f\drw_g=1:EndIf
- If GTStatus(0,5)=1:\b=\b+\ib:f\drw_g=1:EndIf
- If GTStatus(0,6)=1:\c=\c-\ic:f\drw_g=1:EndIf
- If GTStatus(0,8)=1:\c=\c+\ic:f\drw_g=1:EndIf
- If GTStatus(0,10)=1:\pi_mul=\pi_mul-\ip:f\drw_g=1:EndIf ;and pi_mul*Pi
- If GTStatus(0,12)=1:\pi_mul=\pi_mul+\ip:f\drw_g=1:EndIf
- If GTStatus(0,9)<>f\u_flg JMP draw ;update the screen if changing dots or lines
- If GadgetHit=14 AND evw.l=0 JSR updcyc_grp ;subr. to update cycle gadget+update mul. vars
- If GTGetInteger(0,15)<>\pnt ;find the no. points put in by user
- \pnt=GTGetInteger(0,15)
- If \pnt>1000:\pnt=1000:GTSetInteger 0,15,1000:EndIf ;limit to <1000
- If \pnt<1:\pnt=1:GTSetInteger 0,15,1:EndIf ;and to >0
- f\drw_g=1 ;update after points are inputted
- hlptxt$="The number of points used to draw the graph display."
- EndIf
- RTS
-
- .chkwin_fc
- USEPATH c
- Use Window #win_fc
- If GTGetString(1,0)<>Str$(\x_min)
- \x_min=Val(GTGetString(1,0))
- EndIf
- If GTGetString(1,1)<>Str$(\x_max)
- \x_max=Val(GTGetString(1,1))
- EndIf
- If GTGetString(1,5)<>Str$(\y_min)
- \y_min=Val(GTGetString(1,5))
- EndIf
- If GTGetString(1,6)<>Str$(\y_max)
- \y_max=Val(GTGetString(1,6))
- EndIf
- If f\win_f=1 ;make sure it exists
- If GTStatus(1,2)=1
- f\drw_f=1:GTMenuState 0,1,3,Off
- \xl=QAbs(\x_min)+QAbs(\x_max)
- \yl=QAbs(\y_min)+QAbs(\y_max)
- hlptxt$="You have started to draw a convergence diagram where `c' is the y-value"
- EndIf
- If GTStatus(1,3)=1
- f\drw_f=0:GTMenuState 0,1,3,On
- hlptxt$="Halted drawing process..."
- EndIf
- If GTStatus(1,4)=1 ;clear
- Use Window 3
- f\drw_f=0
- \pos_x=0:\c=\x_min
- WBox 0,0,InnerWidth,InnerHeight,0
- hlptxt$="Cleared the drawing window..."
- EndIf
- EndIf
- If GadgetHit=7 AND evw.l=1
- \pos_x=0:\c=\x_min:f\drw_f=0
- JSR updcyc_frc
- EndIf
- If GTGetInteger(1,8)<>\iter ;find no. iterations
- \iter=GTGetInteger(1,8)
- If \iter>128 \iter=128
- GTSetInteger 1,8,\iter
- hlptxt$="This changes the number of iterations per pixel; so bigger values will take longer, and smaller ones, shorter."
- EndIf
- RTS
-
- ;.chkwin_f
- ; USEPATH c
- ; Use Window #win_f ;check size of frc win
- ; If ev.l=$8 AND evw.l=3
- ; Use Window 3
- ; mx_min.w=(WMouseX-QAbs(\x_min)*\stp_x)/\stp_x-5
- ; mx_max.w=(WMouseX-QAbs(\x_min)*\stp_x)/\stp_x+5
- ; my_min.w=(WMouseY-QAbs(\y_min)*\stp_y)/\stp_y-5
- ; my_max.w=(WMouseY-QAbs(\y_min)*\stp_y)/\stp_y+5
- ; \x_min=mx_min,mx_max,my_min,my_max ;then make a range
- ; \pos_x=0:\c=\x_min
- ; GTSetString 1,0,Str$(\x_min):GTSetString 1,1,Str$(\x_max)
- ; GTSetString 1,5,Str$(\y_min):GTSetString 1,6,Str$(\y_max)
- ; EndIf
- ;RTS
-
- .chkwin_h
- Use Window #win_h
- If ev.l=$40000 ;choose the txt displayed
- Select evw
- Case #win_c
- hlptxt$="This window controls the value of the constants in the equations."
- Case #win_fc
- hlptxt$="This window controls the fractal drawing window, and lets you alter the plot ranges."
- Case #win_g
- hlptxt$="This window displays the current module's graph function, depending on the constants."
- Case #win_f
- hlptxt$="This window displays a convergence diagram of the current function, where the colour shows speed "
- hlptxt$=hlptxt$+"of convergence"
- Case #win_h
- hlptxt$="This is the help box and is supposed to give you 'helpful' comments..."
- Case #win_p
- hlptxt$="This window controls the preferences for Module-Grapher"
- End Select
- EndIf
- If hlptxt$<>hlptxt_old$ AND f\win_h=1
- GTSetString 2,0,hlptxt$
- hlptxt_old$=hlptxt$
- EndIf
- RTS
-
- .chkwin_p
- Use Window #win_p
- If GTStatus(3,0)=1 OR GTStatus(3,1)=1 ;save/use
- g\ia=Val(GTGetString(3,3)):g\ib=Val(GTGetString(3,4))
- g\ic=Val(GTGetString(3,5)):g\ip=Val(GTGetString(3,6))
- If GTStatus(3,8)<>f\r_flg AND GTStatus(3,0)=1
- f\r_flg=GTStatus(3,8)
- GetIconObject(mg$)
- If LCase$(FindToolValue("REQUESTERS"))<>"on"
- evt=SetToolValue("REQUESTERS","ON")
- Else:evt=SetToolValue("REQUESTERS","OFF")
- EndIf
- PutIconObject(mg$):FreeIconObject
- EndIf
- If GTStatus(3,0)=1 JSR prefs
- DetachGTList 3:CloseWindow 5:f\win_p=0
- EndIf
- If GTStatus(3,2)=1 ;cancel
- DetachGTList 3:CloseWindow 5:f\win_p=0
- EndIf
- If GTStatus(3,7)=1
- *f=ASLFontRequest(0)
- Request "Watch it!","Not a fully implemented feature... :))","Okay, I`ll just have to do without it"
- ; If *f
- ; LoadFont 0,*f\name,*f\ysize
- ; ysize=*f\ysize
- ; JSR close:JSR open ;refresh the display
- ; EndIf
- EndIf
- RTS
-
- .chkcmd
- evcmd.l=ExchangeMessage
- Select evcmd
- Case CxKill
- JMP quit
- Case CxDisAppear
- JSR iconify
- Case CxAppear
- JSR open:DelAppIcon(0)
- ; Case CxDisable
- ; Repeat
- ; VWait
- ; Until ExchangeMessage=CxEnable
- End Select
- RTS
-
- logo:
- ; IncBin "data/logo.shp"
-
-